package c.h.a.d0;

import android.app.ActivityManager;
import android.app.ActivityManager.MemoryInfo;
import android.content.Context;
import android.os.Environment;
import android.os.StatFs;
import android.text.TextUtils;
import b.i.c.a;
import c.h.a.m0.k;

/* compiled from: MemoryInfo */
public class d {
    public Context a;
    public double b;
    public double c;
    public double d;
    public double e;
    public String f;

    public d(Context context) {
        this.a = context.getApplicationContext();
    }

    public void a() {
        String str = "/data";
        try {
            StatFs statFs = new StatFs(str);
            this.c = (((((double) statFs.getBlockSizeLong()) * ((double) statFs.getAvailableBlocksLong())) / 1024.0d) / 1024.0d) / 1024.0d;
            double blockSizeLong = (((((double) statFs.getBlockSizeLong()) * ((double) statFs.getBlockCountLong())) / 1024.0d) / 1024.0d) / 1024.0d;
            this.b = blockSizeLong;
            this.d = blockSizeLong - this.c;
            long blockSizeLong2 = statFs.getBlockSizeLong() * statFs.getBlockCountLong();
            long blockSizeLong3 = statFs.getBlockSizeLong();
            long availableBlocksLong = statFs.getAvailableBlocksLong();
            Long.signum(blockSizeLong3);
            this.e = (double) (((blockSizeLong2 - (blockSizeLong3 * availableBlocksLong)) * 100) / (statFs.getBlockSizeLong() * statFs.getBlockCountLong()));
            this.f = str;
        } catch (Exception unused) {
        }
    }

    public boolean b() {
        try {
            if (!TextUtils.equals(Environment.getExternalStorageState(), "mounted")) {
                return false;
            }
            Context context = this.a;
            Object obj = a.a;
            if (context.getExternalFilesDirs(null).length < 2) {
                return false;
            }
            String[] I = k.I(this.a);
            if (I == null) {
                return false;
            }
            if (I.length == 0) {
                return false;
            }
            StatFs statFs = new StatFs(I[0]);
            this.c = (((((double) statFs.getBlockSizeLong()) * ((double) statFs.getAvailableBlocksLong())) / 1024.0d) / 1024.0d) / 1024.0d;
            double blockSizeLong = (((((double) statFs.getBlockSizeLong()) * ((double) statFs.getBlockCountLong())) / 1024.0d) / 1024.0d) / 1024.0d;
            this.b = blockSizeLong;
            this.d = blockSizeLong - this.c;
            long blockSizeLong2 = statFs.getBlockSizeLong() * statFs.getBlockCountLong();
            long blockSizeLong3 = statFs.getBlockSizeLong();
            long availableBlocksLong = statFs.getAvailableBlocksLong();
            Long.signum(blockSizeLong3);
            this.e = (double) (((blockSizeLong2 - (blockSizeLong3 * availableBlocksLong)) * 100) / (statFs.getBlockSizeLong() * statFs.getBlockCountLong()));
            this.f = I[0];
            return true;
        } catch (Exception unused) {
            return false;
        }
    }

    public void c() {
        try {
            StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
            this.c = (((((double) statFs.getBlockSizeLong()) * ((double) statFs.getAvailableBlocksLong())) / 1024.0d) / 1024.0d) / 1024.0d;
            double blockSizeLong = (((((double) statFs.getBlockSizeLong()) * ((double) statFs.getBlockCountLong())) / 1024.0d) / 1024.0d) / 1024.0d;
            this.b = blockSizeLong;
            this.d = blockSizeLong - this.c;
            long blockSizeLong2 = statFs.getBlockSizeLong() * statFs.getBlockCountLong();
            long blockSizeLong3 = statFs.getBlockSizeLong();
            long availableBlocksLong = statFs.getAvailableBlocksLong();
            Long.signum(blockSizeLong3);
            this.e = (double) (((blockSizeLong2 - (blockSizeLong3 * availableBlocksLong)) * 100) / (statFs.getBlockSizeLong() * statFs.getBlockCountLong()));
            this.f = Environment.getExternalStorageDirectory().getPath();
        } catch (Exception unused) {
        }
    }

    public void d() {
        try {
            MemoryInfo memoryInfo = new MemoryInfo();
            ActivityManager activityManager = (ActivityManager) this.a.getSystemService("activity");
            if (activityManager != null) {
                activityManager.getMemoryInfo(memoryInfo);
                double d = (double) ((memoryInfo.availMem / 1024) / 1024);
                this.c = d;
                double d2 = (double) ((memoryInfo.totalMem / 1024) / 1024);
                this.b = d2;
                double d3 = d2 - d;
                this.d = d3;
                this.e = (d3 * 100.0d) / d2;
            }
        } catch (Exception unused) {
        }
    }

    public void e() {
        try {
            StatFs statFs = new StatFs(Environment.getRootDirectory().getAbsolutePath());
            this.c = (((((double) statFs.getBlockSizeLong()) * ((double) statFs.getAvailableBlocksLong())) / 1024.0d) / 1024.0d) / 1024.0d;
            double blockSizeLong = (((((double) statFs.getBlockSizeLong()) * ((double) statFs.getBlockCountLong())) / 1024.0d) / 1024.0d) / 1024.0d;
            this.b = blockSizeLong;
            this.d = blockSizeLong - this.c;
            long blockSizeLong2 = statFs.getBlockSizeLong() * statFs.getBlockCountLong();
            long blockSizeLong3 = statFs.getBlockSizeLong();
            long availableBlocksLong = statFs.getAvailableBlocksLong();
            Long.signum(blockSizeLong3);
            this.e = (double) (((blockSizeLong2 - (blockSizeLong3 * availableBlocksLong)) * 100) / (statFs.getBlockSizeLong() * statFs.getBlockCountLong()));
            this.f = Environment.getRootDirectory().getAbsolutePath();
        } catch (Exception unused) {
        }
    }
}
